<template>
	<view>
	<view class="pay-c">
		<view class="order-number">
			<text class="desc">订单编号：</text>
			<text>{{orderList.orderSn}}</text>
		</view>
		<view class="order-price">
			<text class="desc">订单金额：</text>
			<text>{{orderList.totalAmount}}元</text>
		
		</view>
		 
		 <view class="content">
		 	<view class="title">
		 		选择支付方式
		 	</view>
			<view class="content-c">
				<view class="row">
					<image src="../../../../static/icons/alipay.png" mode=""></image>
					<view class="pay" >
						支付宝支付
					</view>
					<view >
						 <evan-radio v-model="pay" label="1" primary-color="#354e44" @change="changePay"></evan-radio>
					</view>
				</view>
				<view class="row">
					<image src="../../../../static/icons/wxpay.png" mode="" ></image>
					<view class="pay">
						微信支付
					</view>
					<view >
						 <evan-radio v-model="pay" label="2" primary-color="#354e44" @change="changePay"></evan-radio>
					</view>
				</view>
			</view>
		 
		 </view>
		 
		 <view class="pays">
		 	<view class="btns" @tap="payAll">
		 		立即支付
		 	</view>
			<view class="pay-desc">
				<view class="fir">
					点击立即支付，即代表您同意
				</view>
				<view class="sec">
					《条款协议》
				</view>
			</view>
		 </view>
	</view>
	
	</view>
</template>

<script>
	import{payConfirm} from "../../../../utils/goodsInfo/addCar/order/index.js"
	export default {
		data() {
			return {
				 pay:'1',
				orderList:{},
				orderId:''
			}
		},
		methods: {
			changePay(e){
				console.log(Number(e))
				
			},
			payAll(){
				var payType= Number(this.pay)
				const price=this.orderList.totalAmount
				payConfirm({
					orderId:this.orderId,
					payType,
				}).then(res=>{
					if(res.success){
						uni.showToast({
							title:"支付成功"
						})
						setTimeout(()=>{
							uni.navigateTo({
								url:'/pages/cart/order/payInfo/payInfo?price='+price
							})
						},1000)
					}
				})
			}
		},
		onShow() {
		this.orderList=uni.getStorageSync("oderList")
		this.orderId=this.orderList.orderId
		// console.log(this.orderList)
		
		}
	}
</script>

<style scoped lang="scss">
.pay-c{
	width: 95%;
	margin: 0 auto;
	.order-number,.order-price{
		margin-top: 40rpx;
		.desc{
			color: #7d7d7d;
		}
	}
	.content{
		margin-top: 60rpx;
		.content-c{
			margin-top: 20rpx;
			.row{
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 20rpx;
				image{
					width: 80rpx;
					height: 80rpx;
				}
				.pay{
					flex: 2;
				}
			}
		}
	}
	.pays{
		width: 90%;
		margin: 0 auto;
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 100rpx;
		.pay-desc{
			margin-top: 20rpx;
			display: flex;
			justify-content: center;
			align-items: baseline;
			font-size: 24rpx;
			color: #999;
			.sec{
				color: #5a9ef7;
			}
		}
	}
	.btns{
			width: 70%;
		    height: 80rpx;
		    border-radius: 80rpx;
		   
		    display: flex;
		   
		    justify-content: center;
		 
		    align-items: center;
		    color: #fff;
		    background-color: #354e44;
		    box-shadow: 0px 4rpx 10rpx rgba(0,0,0,.2);
	}
}
</style>
